package com.xiaotu.spider.baidu.pipeline;

import com.xiaotu.common.model.StarModel;
import com.xiaotu.common.model.StarStringModel;
import com.xiaotu.common.model.TVStringModel;
import com.xiaotu.common.util.Constants;
import com.xiaotu.common.util.DataRedisKeyUtils;
import com.xiaotu.spider.APipeline;
import org.springframework.stereotype.Component;
import us.codecraft.webmagic.ResultItems;
import us.codecraft.webmagic.Task;

@Component("StarBaikeInfoPipelineBak")
public class StarBaikeInfoPipelineBak extends APipeline
{
    @Override
    protected void doProcess(ResultItems resultItems, Task task)
    {

        StarStringModel model = resultItems.get(StarStringModel.class.getName());
        if (model == null)
            return;

        String key = DataRedisKeyUtils.getKey(Constants.DataRedisKey.STAR_BAIKE_INFO_YYYYMMDD);
        cacheHandler.hSet(key, model.getStarid(), model);


        StarModel models = resultItems.get(StarModel.class.getName());
        if (models == null)
            return;

        String key2 = DataRedisKeyUtils.getKey(Constants.DataRedisKey.STAR_BAIKE_NOT_INFO_YYYYMMDD);
        cacheHandler.hSet(key2, models.getStarId(), models);
    }

}
